home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / QUICKTIM / MP_SOURC / ABOUT_DL.C next >
C/C++ Source or Header  |  1992-06-15  |  2KB  |  75 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <oops.h>
  5.  
  6. #include "about_Dlog.h"
  7. #include "Alert_Class.h"
  8.  
  9. extern Alert_Class *myAlert;
  10.  
  11. /**********************************************************************/
  12. void about_Dlog::HandleDialog(EventRecord *aEvent)
  13. {
  14.     GrafPtr oldPort;
  15.     DialogPtr myDlog;
  16.     int itemHit;
  17.     int dialogDone;
  18.     Handle itemHandle;
  19.     char stuff[80];
  20.     
  21.     /*-------------------------
  22.     Shadow for handle protection
  23.     -------------------------*/
  24.     myDlog = this->myDlog;
  25.     itemHit = this->itemHit;
  26.     dialogDone = this->dialogDone;
  27.     
  28.     GetPort(&oldPort);
  29.     
  30.     if ( myDlog == NULL ) {
  31.         SysBeep(7);
  32.         (*myAlert).AlertStop("\pFatal Error",
  33.                             "\pmyDlog is NULL",
  34.                             "\pDlog::HandleDlog",NULL);
  35.     } /* end if */
  36.     
  37.     SetItemValues();
  38.     BringToFront(myDlog);
  39.     ShowWindow(myDlog);
  40.     SelectWindow(myDlog);
  41.  
  42.     // If Item #1 happened to be a button then we
  43.     // asume it is the OKAY button and draw the
  44.     // Default rect around it. However, my about box
  45.     // does not use a button to close.
  46.     GetDItem(myDlog,1,&itemType,&itemHandle,&itemRect);
  47.     
  48.     if ( itemType == (btnCtrl+ctrlItem)  ) {
  49.         
  50.         SetPort(myDlog);
  51.         PenSize(3,3);
  52.         InsetRect(&itemRect, -4, -4);
  53.         FrameRoundRect(&itemRect,16,16);
  54.         PenNormal();
  55.     } /* end if */
  56.     
  57.     dialogDone = 0;
  58.     
  59.     // There is a user Item that is #1, when clicked in will
  60.     // cause the dialog to be done and close.
  61.     while ( dialogDone == 0  ) {
  62.         ModalDialog(NULL,&itemHit);
  63.         this->itemHit = itemHit;
  64.         if (itemHit == 1) {
  65.             dialogDone = 1;
  66.         }
  67.     } /* end while */
  68.     
  69.     HideWindow(myDlog);
  70.     SetPort(oldPort);
  71.     BringToFront(oldPort);
  72.     SelectWindow(oldPort);
  73. }
  74. /**********************************************************************/
  75.